package InterfaceDemo5;

public class TestPolymorphism {
    public static void main(String[] args) {
        // 多态引用与强制类型转换演示
        Movable birdAsMovable = new Bird();
        ((Flyable) birdAsMovable).fly(); // 调用Flyable接口的fly方法

        Flyable birdAsFlyable = new Bird();
        ((Movable) birdAsFlyable).move(); // 调用Movable接口的move方法

        Flyable planeAsFlyable = new Plane();
        ((Movable) planeAsFlyable).move(); // 调用Movable接口的move方法

        // 完整行为演示
        Bird bird = new Bird();
        bird.move();
        bird.fly();
        bird.stop();

        Plane plane = new Plane();
        plane.move();
        plane.fly();
        plane.stop();
    }
}
